//
//  SEGIntegralExchangeResultViewController.m
//  ExcellentHome
//
//  Created by 揭婧雯 on 2017/6/15.
//  Copyright © 2017年 陈区. All rights reserved.
//

#import "SEGIntegralExchangeResultViewController.h"

#import <Masonry/Masonry.h>

#if __has_include(<Commom/SEGColorManager.h>)
#import <Commom/SEGColorManager.h>
#else
#import "SEGColorManager.h"
#endif

#if __has_include(<Commom/SEGBussinessConstHeader.h>)
#import <Commom/SEGBussinessConstHeader.h>
#else
#import "SEGBussinessConstHeader.h"
#endif

#if __has_include(<CommonMediator/SEGMediatorHeader.h>)
#import <CommonMediator/SEGMediatorHeader.h>
#else
#import "SEGMediatorHeader.h"
#endif

#if __has_include(<Commom/SEGUrlAddress.h>)
#import <Commom/SEGUrlAddress.h>
#else
#import "SEGUrlAddress.h"
#endif

#if __has_include(<Commom/SEGServerManager.h>)
#import <Commom/SEGServerManager.h>
#else
#import "SEGServerManager.h"
#endif

#import "SEGIntegralExchangeResultViewModel.h"
@interface SEGIntegralExchangeResultViewController ()
@property(nonatomic, strong) SEGIntegralExchangeResultViewModel *viewModel;
@end

@implementation SEGIntegralExchangeResultViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"兑换结果";
    [self setupSubviews];
}

//返回按钮
- (void)onNavigationLeftButtonClicked:(UIButton*)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)setupSubviews
{
    UIView *bgView = [[UIView alloc] init];
    bgView.backgroundColor = kColor_W;
    [self.view addSubview:bgView];
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view);
        make.left.equalTo(self.view);
        make.right.equalTo(self.view);
    }];
    
    UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:SEGPicName(@"pic_success")]];
    [bgView addSubview:imageView];
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(bgView);
        make.top.equalTo(bgView).mas_offset(50);
        make.width.mas_equalTo(46);
        make.height.mas_equalTo(46);
    }];
    
    UILabel *label1 = [[UILabel alloc] init];
    label1.text = @"兑换成功";
    label1.textColor = kColor_1;
    label1.font = kFont_18;
    [bgView addSubview:label1];
    [label1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(imageView.mas_bottom).mas_offset(13);
        make.centerX.equalTo(imageView);
    }];
    
    UILabel *label2 = [[UILabel alloc] init];
    label2.text = self.descString;
    label2.textColor = kColor_3;
    label2.font = kFont_13;
    [bgView addSubview:label2];
    [label2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(label1.mas_bottom).mas_offset(11);
        make.centerX.equalTo(label1);
    }];
    
    UIButton *button = [[UIButton alloc] init];
    [button setTitle:@"去看看" forState:UIControlStateNormal];
    [button setTitleColor:kColor_W forState:UIControlStateNormal];
    button.titleLabel.font = kFont_16;
    button.backgroundColor = kColor_T;
    button.layer.masksToBounds = YES;
    button.layer.cornerRadius = 3;
    [button addTarget:self action:@selector(goToSeeRecord) forControlEvents:UIControlEventTouchUpInside];
    [bgView addSubview:button];
    [button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(label2.mas_bottom).mas_offset(29);
        make.left.equalTo(bgView).mas_offset(15);
        make.right.equalTo(bgView).mas_offset(-15);
        make.height.mas_equalTo(40);
        make.bottom.equalTo(bgView).mas_equalTo(-20);
    }];
}

- (void)goToSeeRecord
{
    //兑换记录
    NSDictionary *params = @{@"linkURL":kIntegarlExchangeRecord};
    UIViewController *VC = [[SEGUhomeMediator sharedInstance] seg_initWebViewLoadController:params];
    [self.navigationController pushViewController:VC animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}
#pragma mark - init Views
-(void)segInitViews{

}

#pragma mark - RAC Data Binding
- (void)bindViewModel {
}

#pragma mark - getter
-(SEGIntegralExchangeResultViewModel *)viewModel{
    if (!_viewModel) {
        _viewModel = [[SEGIntegralExchangeResultViewModel alloc]init];
    }
    return _viewModel;
}
@end
